//
//  FZHomeService.m
//  Pods
//
//  Created by CyonLeuPro on 15/5/19.
//
//

#import "FZHomeService.h"
#import "SRNetWorkManager.h"
#import <SRAPICreater.h>
#import "FZHomeSectionModel.h"

@implementation FZHomeService

- (void)queryDataWithSuccessBlock:(FZSuccessBlock)successBlock failBlock:(FZFailureBlock)failureBlock {
    
    NSString *urlString = [[SRAPICreater sharedInstance] APIWithName:@"home_index"];
    SRNetWorkManager *manager = [SRNetWorkManager sharedInstance];
    [manager GET:urlString needCache:YES parameters:nil responseClass:[FZHomeSectionModel class] success:successBlock failure:failureBlock];
}

- (void)queryHotVideoDataWithRand:(NSInteger)randNum SuccessBlock:(FZSuccessBlock)successBlock failBlock:(FZFailureBlock)failureBlock {
    NSString *urlString = [[SRAPICreater sharedInstance] APIWithName:@"home_hotcourse"];
    SRNetWorkManager *manager = [SRNetWorkManager sharedInstance];
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setValue:@(randNum) forKey:@"rand_num"];
    [manager GET:urlString needCache:YES parameters:params responseClass:[FZHomeSectionModel class] success:successBlock failure:failureBlock];
}


+ (void)queryBasicAdvertSuccessBlock:(FZSuccessBlock)successBlock failBlock:(FZFailureBlock)failureBlock {
    NSString *urlString = [[SRAPICreater sharedInstance] APIWithName:@"basic_advert"];
    SRNetWorkManager *manager = [SRNetWorkManager sharedInstance];
    
    [manager GET:urlString needCache:YES parameters:nil responseClass:[FZHomeSectionModel class] success:successBlock failure:failureBlock];
}

@end
